/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Donnees;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author mizho
 */
@Entity
@Table(name = "tdexo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TdExo.findAll", query = "SELECT t FROM TdExo t"),
    @NamedQuery(name = "TdExo.findByIdtdexo", query = "SELECT t FROM TdExo t WHERE t.idtdexo = :idtdexo"),
    @NamedQuery(name = "TdExo.findByIndexexo", query = "SELECT t FROM TdExo t WHERE t.indexexo = :indexexo")})
public class TdExo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2147483647)
    @Column(name = "idtdexo")
    private String idtdexo;
    @Basic(optional = false)
    @NotNull
    @Column(name = "indexexo")
    private int indexexo;
    @JoinColumn(name = "td", referencedColumnName = "idtd")
    @ManyToOne(optional = false)
    private Td td;
    @JoinColumn(name = "exercice", referencedColumnName = "idexercice")
    @ManyToOne(optional = false)
    private Exercice exercice;

    public TdExo() {
    }

    public TdExo(String idtdexo) {
        this.idtdexo = idtdexo;
    }

    public TdExo(String idtdexo, int indexexo) {
        this.idtdexo = idtdexo;
        this.indexexo = indexexo;
    }

    public String getIdtdexo() {
        return idtdexo;
    }

    public void setIdtdexo(String idtdexo) {
        this.idtdexo = idtdexo;
    }

    public int getIndexexo() {
        return indexexo;
    }

    public void setIndexexo(int indexexo) {
        this.indexexo = indexexo;
    }

    public Td getTd() {
        return td;
    }

    public void setTd(Td td) {
        this.td = td;
    }

    public Exercice getExercice() {
        return exercice;
    }

    public void setExercice(Exercice exercice) {
        this.exercice = exercice;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idtdexo != null ? idtdexo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TdExo)) {
            return false;
        }
        TdExo other = (TdExo) object;
        if ((this.idtdexo == null && other.idtdexo != null) || (this.idtdexo != null && !this.idtdexo.equals(other.idtdexo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Donnees.TdExo[ idtdexo=" + idtdexo + " ]";
    }
    
}
